package src.com.doit.demo;

import java.util.ArrayList;
import java.util.Scanner;

public class test {
    public static void main(String[] args) {
        ArrayList<Person>list = new ArrayList<>();
        nameAdd(list);//存储信息的方法


        new Person().setName("撒日朗");
        System.out.println(new Person().getName());

        method(list.get(0));
        Person p = method2();
    }

    private static void nameAdd(ArrayList<Person> list) {
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < 3; i++) {
            System.out.println("请输入姓名");
            String a = sc.next();
            System.out.println("请输入年龄");
            int b = sc.nextInt();
            list.add(new Person(a,b));//压入集合就不再那么麻烦了
        }
    }

    private static Person method2() {
        return new Person();
    }

    private static void method(Person person) {
        System.out.println(person.getName()+person.getAge());
    }
}
